package com.ksyun.ks3.services.handler;

import com.ksyun.ks3.exception.Ks3ClientException;
import com.ksyun.ks3.exception.Ks3ServiceException;
import com.ksyun.ks3.model.result.DeleteBucketReplicationResult;
import com.ksyun.ks3.services.request.DeleteBucketReplicationRequest;
import com.ksyun.ks3.services.request.Ks3HttpRequest;
import com.ksyun.ks3.util.ResponseUtils;

import okhttp3.Headers;

public abstract class DeleteBucketReplicationResponseHandler extends Ks3HttpResponseHandler {

    public abstract void onFailure(DeleteBucketReplicationRequest request, Ks3ClientException clientException, Ks3ServiceException serviceException);

    public abstract void onSuccess(DeleteBucketReplicationRequest request, DeleteBucketReplicationResult result);

    @Override
    public final void onSuccess(Ks3HttpRequest request, int statusCode, Headers responseHeaders, byte[] response) {
        DeleteBucketReplicationResult result = new DeleteBucketReplicationResult();
        result.setStatusCode(statusCode);
        result.setHeaders(ResponseUtils.parseResponseHeaders(responseHeaders));
        this.onSuccess((DeleteBucketReplicationRequest) request, result);
    }

    @Override
    public final void onFailure(Ks3HttpRequest request, Ks3ClientException clientException, Ks3ServiceException serviceException) {
        this.onFailure((DeleteBucketReplicationRequest) request, clientException, serviceException);
    }

    @Override
    public final void onProgress(long bytesWritten, long totalSize) {
    }

    @Override
    public final void onStart() {
    }

    @Override
    public final void onFinish() {
    }

    @Override
    public final void onCancel() {
    }
}
